#ifndef __CHARACTER_H__
#define __CHARACTER_H__


#include <string>
#include <vector>

#include "Coordinate.h"
#include "Item.h"


/**
 *  @file
 *  Class "Character"
 */

/**
 * The Character class.
 * It is used for both player and monsters
 */
class Character
{
public:
	Character();
	~Character();
	virtual Character&		operator=(const Character& characterToCopy);


	std::string				getName();
	void					setName(std::string name);
	void					setInitHP(int val);
	void					setInitMP(int val);
	void					setHP(int val);
	void					setMP(int val);
	int						getHP();
	int						getMP();
	int						getMaxHP();
	void					setHP(int HP, int maxHP);
	void					setMP(int MP, int maxMP);
	void					setXP(int XP, int maxXP);
	void					setXP(int val);
	void					addXP(int val);
	int						getXP();
	void					setLevel(int level);
	unsigned int			getLevel();
	int						getPhysicalAttack();
	int						getPhysicalDefense();
	void					setPhysicalCombatAttr(int att, int def);
	void					setMagicalCombatAttr(int att, int def);
	void					setPhysicalAttack(int val);
	void					setPhysicalDefense(int val);
	void					setMagicalAttack(int val);
	void					setMagicalDefense(int val);
	void					setEvasion(int val);
	void					setDiscretion(int iStealth, int iPerception);

	bool					isDead();
	void					takeDamage(int damage);
	void					attack(Character& target);
	int						getArmorFactor();
	
	int						addEquipment(const char* strEquipment, std::vector<Item*> itemList);
	void					delEquipment(int itemId);
	void					addInBackpack(int itemId);
	void					removeFromBackpack(int itemId);
	void					equipRightHand(int itemId);
	void					equipLeftHand(int itemId);
	void					equipBody(int itemId);
	void					unequipBody();
	void					unequipRightHand();
	void					unequipLeftHand();
	Item*					getRightHandItem();
	Item*					getLeftHandItem();
	Item*					getBodyItem();
	void					setGold(int val);
	void					addGold(int val);
	int						getGold();
	int						getNumItemInEquipment();

	void					print();
	void					printCombatFactor();
	void					printFurtivity();
	void					printEquipment();
	void					printOnlyEquipment();
	void					printOnlySimpleEquipment();
	void					printOnlyBackpack();
	void					printOnlySimpleBackpack();
	void					printOnlyRightHand();
	void					printOnlyLeftHand();
	void					printOnlyBody();

protected:
	int						m_id;						//!< Unique ID of the Character
	static int				m_staticID;					//!< Static member which is incremented every time a Character is created
	std::string				m_strName;					//!< Name of the Character
	int						m_iHP;						//!< Current Health Points
	int						m_iMaxHP;					//!< Maximum Health Points
	int						m_iMP;						//!< Current Magic Points
	int						m_iMaxMP;					//!< Maximum Magic Points
	int						m_iXP;						//!< Current Experience Points
	int						m_iMaxXP;					//!< TODO: If maximum Experience Point is reached we level Up the Character (need to remove this and use the leveling info in the XML file. Also this should only be available for the class Player)
	int						m_iLevel;					//!< Current Level of Character
	int						m_iGold;					//!< Number of Gold pieces the Character has
	int						m_iPhysicalAttack;			//!< Attack attribute of the Character
	int						m_iPhysicalDefense;			//!< Defense attribute of the Character
	int						m_iMagicalAttack;			//!< TODO: Magical attack of the Character. Magical attacks are not yet implemented
	int						m_iMagicalDefense;			//!< TODO: Magical defense of the Character. Magical defense is not yet used
	int						m_iEvasion;					//!< TODO: Evasion, at the moment it is not used. Maybe in the future a player will have to dodge arrow or huge rolling rocks
	int						m_iStealth;					//!< TODO: Stealth, how stealthy a character is. Not used yet but maybe later to sneak behing a mog
	int						m_iPerception;				//!< TODO: Perception, not used yet but maybe later if we want the monsters to play ninja style

	Item*					m_rightHand;				//!< Item equiped with the right hand
	Item*					m_leftHand;					//!< Item equiped with the left hand
	Item*					m_body;						//!< Armor worn
	std::vector<Item*>		m_backpack;					//!< Items in backpack
	std::vector<Item*>		m_equipment;				//!< Complete equipment list

	int						getNextID();

};


#endif // __CHARACTER_H__